package edu.avans.hartigehap.domain;

import javax.persistence.Entity;
import javax.persistence.Transient;

@Entity
public class ConceptState extends WebState {

	WebOrder webOrder;
	
	public ConceptState(WebOrder webOrder) {
		this.webOrder = webOrder;
	}


	
	@Override
	@Transient
	public String getMessage() {
		return "Dit is het bericht dat je krijgt met ConceptState";
		
	}



	@Override
	public void changeState() {
		webOrder.setOrderedState();
	}

	
//	@Override
//	public void addOrderItem(WebDish dish, Collection<WebOrderItem> orderItems) {		
//		Iterator<WebOrderItem> orderItemIterator = orderItems.iterator();
//		boolean found = false;
//		while (orderItemIterator.hasNext()) {
//			WebOrderItem orderItem = orderItemIterator.next();
//			if (orderItem.getWebDish().equals(dish)) {
//				orderItem.incrementQuantity();
//				found = true;
//				break;
//			}
//		}
//		if (!found) {
//			WebOrderItem orderItem = new WebOrderItem(dish, 1);
//			orderItems.add(orderItem);
//		}
//	}
//	
//	public void deleteOrderItem(WebDish dish, Collection<WebOrderItem> orderItems) {
//		Iterator<WebOrderItem> orderItemIterator = orderItems.iterator();
//		boolean found = false;
//		while (orderItemIterator.hasNext()) {
//			WebOrderItem orderItem = orderItemIterator.next();
//			if (orderItem.getWebDish().equals(dish)) {
//				found = true;
//				if (orderItem.getQuantity() > 1) {
//					orderItem.decrementQuantity();
//				} else { // orderItem.getQuantity() == 1
//					orderItemIterator.remove();
//				}
//				break;
//			}
//		}
//		if (!found) {
//			// do nothing
//		}
//	}

}
